package interlocking.model;

import java.util.List;
import java.util.Map;

public class Route {
    private final String id;                // 进路唯一标识符
    private final String signal;           // 起始信号机ID
    private final Map<String,Switch> switches;    // 进路中包含的道岔列表
    private final Map<String,TrackCircuit> tracks;      // 进路中包含的轨道区段列表
    private final RouteType type;           // 进路类型(列车/调车)
    private RouteState state;         // 进路状态(正在建立/锁闭/解锁等)


    public Route(String id, String signal, Map<String,Switch> switches,
                 Map<String,TrackCircuit> tracks, RouteType type) {
        this.id = id;
        this.signal = signal;
        this.switches = switches;
        this.tracks = tracks;
        this.type = type;
        this.state = RouteState.PENDING; // 初始状态为待建立
    }

    // 枚举：进路类型
    public enum RouteType {
        TRAIN,      // 列车进路
        SHUNTING    // 调车进路
    }

    // 枚举：进路状态
    public enum RouteState {
        PENDING,    // 待建立
        LOCKED,     // 已锁闭
        USED,       // 正在使用
        RELEASED,   // 已解锁
        CANCELED    // 已取消
    }

    // Getter和Setter方法
    public String getId() {
        return id;
    }

    public String getSignal() {
        return signal;
    }

    public Map<String,Switch> getSwitches() {
        return switches;
    }

    public Map<String,TrackCircuit> getTracks() {
        return tracks;


    }

    public RouteType getType() {
        return type;
    }

    public RouteState getState() {
        return state;
    }

    public void setState(RouteState state) {
        this.state = state;
    }


}
